import  pandas as pd
import  xlrd
import  matplotlib.pyplot as  plt
#导入数据
df = pd.read_excel('D:/dataset/全国受教育程度情况.xls', header=1)

df1 = df.iloc[0:12:3]

data1  = df1.sort_values(by='毕业生数',ascending=False)
data = list(data1['毕业生数'])
label = list(data1['项目'])

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

fig = plt.figure(figsize=(8, 6),dpi=100)

explode = [0.01,0.01,0.01,0.01]

plt.pie(data,explode=explode, labels=label, startangle=-90, autopct='%0.2f%%')
plt.suptitle("2019年全国高等教育毕业生数占比情况")

fig.text(0.1,0.02, s="数据来源:国家统计局")
#
plt.legend()
plt.savefig("d:/image/task4-27.png")